home *** CD-ROM | disk | FTP | other *** search
- File Dated: 11/14/95
-
- ******************************************************************************
- Quick Start with XLIB
- ******************************************************************************
-
- The user manual is largely dedicated to cover specifics of XLIB which
- will not be of concern to many programmers. A few notes are added here to
- expedite matters for these programmers.
- If you are not an assembly language programmer, then consider using
- EASYX rather than XLIB. EASYX does not require use or knowledge of
- assembly language. The documentation for EASYX is in the file EASYX.DOC.
- If you are familiar with assembly language, then start by reading the
- file DONTREAD.ME. This file is for those who don't particularly enjoy
- reading 60 page user manuals. It is an excellent tutorial. You will
- probably be ready to program with XLIB after working through the tutorial.
- If your program is to be written exclusively in assembly language, then
- examine the files FLAT.INC and FLAT.ASM. FLAT.INC is an include file which
- enables flat-model programming in DOS. FLAT.ASM illustrates usage of
- FLAT.INC.
-
- ******************************************************************************
- Frequently Encountered Problems When Starting XLIB
- ******************************************************************************
-
- The most frequently reported problem with XLIB is in fact no problem at
- all. XLIB presents a registration reminder message when terminating. Some
- interpret this message as meaning that the shareware version of XLIB is
- disabled. This is not the case. The shareware version is fully
- functional. You must register XLIB to obtain a copy of the library that
- does not present the message.
- The registration reminder message is actually a confirmation that XLIB
- has been initiated and terminated successfully. If this message doesn't
- appear in the shareware version, then the main program almost certainly has
- a bug preventing clean termination.
- The second most frequently reported problem is by assembly language
- programmers who find that attempts to initialize XLIB (with INITXLIB) fail
- for lack of DOS memory. MASM programmers must remember to link with the
- CPARM:1 parameter. TASM programmers must resize the memory block into
- which DOS loaded the program (see EXAMP1B.ASM).
-
- ******************************************************************************
- Improvements in XLIB Version 5.1 Over Version 5.0
- ******************************************************************************
-
- 1) FLAT.INC and PMIO.INC contained statements which assumed the presence
- of a floating point unit. These files have been generalized under
- version 5.1.
-
- 2) PMXLOAD did not limit file loads to the size of the destination memory
- block. This bug has been fixed in version 5.1.
-
- ******************************************************************************
- Registering XLIB
- ******************************************************************************
-
- XLIB may be registered for $50. Registrants will be sent a registered
- copy of the XLIB archive along with a printed copy of the user manual.
- Technical support is provided for both registered and unregistered users;
- however, if you have used technical support or intend to use it, then the
- registration fee is $70.
-
- There are four ways to register XLIB. We prefer that you use one of the
- first two methods:
-
- 1) By email using MasterCard or Visa:
-
- Edit the form in the file EMAIL.REG then email the file to TechniLib.
-
- 2) By mail to TechniLib:
-
- Send check or money order along with return address to:
-
- TechniLib Company
- P.O. Box 6818
- Jackson, Ms 39282
- USA
-
- Please write "XLIB" on check or include an explanatory note. An email
- address would also be appreciated.
-
- 3) By credit card through Public (software) Library:
-
- You can order with MC, Visa, Amex, or Discover from Public (software)
- Library by calling 800-2424-PsL or 713-524-6394 or by FAX to 713-524-6398
- or by CIS email to 71355,470. You can also mail credit card orders to PsL
- at P.O.Box 35705, Houston, TX 77235-5705. The product ID for XLIB is 11077.
-
- THE ABOVE NUMBERS ARE FOR ORDERS ONLY. Any questions about the status of
- the shipment of the order, refunds, registration options, product details,
- technical support, volume discounts, dealer pricing, site licenses, etc,
- should NOT be directed to PsL. Direct all such questions to TechniLib.
-
- 4) Through CompuServe:
-
- Use GO SWREG (shareware registration). The program identification number
- is 1778. The program title is XLIB 5.1.
-
-
- XLIB may be registered for $50. Registrants will be sent a registered
- copy of the XLIB archive along with a printed copy of the user manual.
- Technical support is provided for both registered and unregistered users;
- however, if you have used technical support or intend to use it, then the
- registration fee is $70.
-
- ******************************************************************************
- Obtaining the Most Recent Version of XLIB
- ******************************************************************************
-
- The most recent version of XLIB may be downloaded from:
-
- 1) CompuServe - GO MSLANG or GO BCPPDOS then choose ASSEMBLER.
- 2) Internet - oak.oakland.edu under directory \simtel\msdos\c
-
- Expect the archive to be named either XLIBvv.ZIP or DXLIBvv.ZIP where
- vv denotes the version number.
- Keywords for XLIB include: XMS, DPMI, VCPI, DOS, EXTENDER, PROTECTED
- MASM, TASM, TECHNILIB.
-
- ******************************************************************************
- Communicating with TechniLib Via Electronic Mail
- ******************************************************************************
-
- You can communicate with TechniLib via CompuServe or Internet electronic
- mail. Direct CompuServe mail to user ID: 74730,167. Internet users should
- use the address: 74730.167@compuserve.com. Internet users may also send
- mail to davidpyles@delphi.com.
-
- ******************************************************************************
- Instructions for Constructing Protected-Mode Libraries for Microsoft
- ******************************************************************************
-
- The following batch file uses Microsoft LIB to combine an OBJ file with
- XLIB.LIB to produce a protected-mode library. Call the batch file using the
- base name of the OBJ file as the argument. This base name will also be
- given to the library. It is assumed that the OBJ file and XLIB.LIB are in
- the current directory. LIB.EXE is assumed to be in the ..\BIN directory.
-
- @echo on
- del %1.lib
- ..\bin\lib %1.lib /noi +%1.obj+xlib.lib;
-
- The following batch file uses Microsoft LINK and LIB to combine an OBJ
- file with XLIB.LIB to produce a protected-mode library and quick library for
- Microsoft BASIC 7.0. Call the batch file using the base name of the OBJ
- file as the argument. This base name will also be given to the library and
- the quick library. It is assumed that all files apart from LINK.EXE and
- LIB.EXE are in the current directory. The current directory must also
- contain the file QBXQLB.LIB (included in the BASIC distribution disks).
- LINK.EXE and LIB.EXE are assumed to be in the ..\BIN directory.
-
- @echo on
- del %1.qlb
- del %1.lib
- ..\bin\link /q/nopackf xlib.lib+%1.obj,%1.qlb,,qbxqlb.lib;
- ..\bin\lib %1.lib +xlib.lib+%1.obj;
-
- The following command may be used to create a quick library from
- EASYX.LIB. The quick library is called EASYX.QLB:
-
- ..\bin\link /q/nopackf easyx.lib,easyx.qlb,,qbxqlb.lib;
-
- ******************************************************************************
- Instructions for Constructing Libraries and Linking with Borland
- ******************************************************************************
-
- The following batch file uses TLINK to link an OBJ file from TASM with
- XLIBB.LIB to produce a DOS-extended executable. The base name of the OBJ
- is supplied as an argument to the batch file. The executable will be given
- the same base name as the OBJ file. It is assumed that the OBJ file is in
- the current directory and that TLINK is in the ..\BIN directory.
-
- @echo on
- ..\bin\tlink /3/c %1.obj,,,xlibb.lib
-
- The following batch file uses Borland TLIB to combine an OBJ file with
- XLIBB.LIB to produce a protected-mode library. Call the batch file using
- the base name of the OBJ file as the argument. This base name will also be
- given to the library. It is assumed that XLIBB.LIB and the OBJ file are in
- the current directory. TLIB is assumed to be in the ..\BIN directory.
-
- @echo on
- del %1.lib
- ..\bin\tlib /C %1.lib +xlibb.lib+%1.obj
-
- Borland C and Turbo C users can compile within the IDE; however, they
- must use the command line linker because an option will be needed which is
- not included in the IDE linker. In particular, the /3 option will be needed
- to enable processing of 32-bit segments. The appropriate commands to TLINK
- will depend upon the memory model being used. The following batch command
- will link a program called MYPROG with a library call MYLIB under the large
- memory model. The batch command must be issued from the directory
- containing MYPROG.OBJ. It is assumed that TLINK is in the ..\BIN directory
- and that MYLIB.LIB is in the ..\LIB directory. It is also assumed that all
- of the C link libraries are in the ..\LIB directory. The resulting
- executable will be called MYPROG.EXE and the map file will be called
- MYPROG.MAP. The command line is lengthy and is therefore broken into two
- lines below.
-
- --------------------- model specification
- . ----------------- obj file name
- . | ---------- exe file name
- . | | --- map file name
- . ______ ______ ______
- ..\bin\tlink /3/c ..\lib\c0l myprog,myprog,myprog,
-
- ..\lib\mylib ..\lib\fp87 ..\lib\mathl ..\lib\cl
- ----- . .
- | -------------- model specification
- ----------------------------------------- lib file name
-
-
- To link under the small memory model, replace "l" with "s" at the model
- specification characters. Use "m" for the medium model; "c" for the compact
- model, and "h" for the huge model.
-
- ******************************************************************************
- NOEMS and Equivalent Options
- ******************************************************************************
-
- Early versions of XLIB did not initialize properly when the NOEMS or
- equivalent option was being used on the memory manager. This problem should
- be corrected under version 4.1, but we suggest avoiding NOEMS. If the upper
- memory area used by the page is needed, then try FRAME=NONE or equivalent
- option.
- When EMS is present, VCPI has control of the machine. This means that
- XLIB must work cooperatively with VCPI when performing switches to protected
- mode; otherwise, XLIB would cause a protection violation (exception #13).
- VCPI is a subset of EMS. When NOEMS is used, it appeared to former
- versions of XLIB that VCPI was absent. The latter assumption was false,
- because the memory manager was hiding VCPI behind the NOEMS option. XLIB
- then proceeded to perform uncooperative mode switches. This then generated
- the exception. Versions 4.1 and later take measures to detect a deceptive
- memory manager.
-
- ******************************************************************************
- General Debugging Instructions
- ******************************************************************************
-
- See the file SWAT.DOC for instructions toward obtaining a powerful
- protected-mode debugger.
- Neither Turbo Debugger nor Codeview will be able to debug protected-mode
- instructions. However, one should still be able to use the debuggers for
- real-mode areas of a program. Simply step over calls to protected-mode
- procedures.
- Some debuggers tend to have problems when XLIB is initialized for DPMI.
- Use VCPI instead. This is done by setting bit 0 of IFLAGS. Of course, a
- VCPI driver needs to be loaded. EMM386, QEMM386, and 386MAX all have VCPI.
- VCPI cannot run in Windows or OS/2.
- In the event one can debug under DPMI 1.0, then it must be remembered
- that XLIBE and XLIBEB attempt to trap exceptions in real mode, including
- debug exceptions and breakpoints. This probably will not interfere with
- the debugger; however, if problems occur, these features should be disabled
- by setting bit 1 of IFLAGS. This disables all exception trapping and
- prevents remap of hardware interrupts.
-
- ******************************************************************************
- Instructions for Debugging in the Borland IDE
- ******************************************************************************
-
- To run the IDE debugger, XLIB should be initialized for VCPI. However,
- under the default behavior of the IDE, a VCPI program will not be able to
- allocate extended memory within the IDE. There are potentially two reasons
- for this. First, the default behavior of the DPMI kernel under which the
- IDE operates is to claim all EMS memory and convert it to DPMI memory.
- Since VCPI seeks extended memory through EMS, no extended memory will appear
- to be available. To limit the memory consumption of the DPMI kernel,
- include a statement such as the following in the batch file used to invoke
- the IDE:
-
- set dpmimem=maxmem 2000
-
- This statement limits the memory usage of the DPMI kernel to 2000Kb. If
- EMS memory exceeds this amount, then EMS memory will be available to the
- IDE. However, EMS memory will not be available to a VCPI program running
- within the IDE if the IDE has itself consumed all EMS memory. Therefore,
- one may have to limit EMS memory usage of the IDE. This can be done in the
- OPTIONS|ENVIRONMENT|STARTUP menu of the IDE. Typically, EMS memory usage
- should be set to zero here.
-
- ******************************************************************************
- Known Bugs/Peculiarities in Memory Managers, Operating Systems, and Compilers
- ******************************************************************************
-
- QEMM and QDPMI:
- ---------------
-
- 1) All versions of QDPMI appear to map physical address spaces incorrectly.
- The actual mapping call will succeed; however, this call affects QDPMI
- internally such that subsequent calls to allocate extended memory do not
- function correctly. This means that MAPIO and PMMAPIO will not work
- reliably with QDPMI.
-
- 2) QDPMI apparently does not function properly when the NOEMS option has
- been used on QEMM. NOEMS typically should not be used with any memory
- manager. If you need the space normally allocated to the EMS page frame,
- then set FRAME=NONE (or equivalent option) instead of using NOEMS.
-
- These problems have been reported to Quarterdeck. Corrections are
- expected in the near future.
-
- 386MAX:
- -------
-
- 1) 386MAX versions 6.X and 7.0 leave interrupts disabled after calls to
- certain VCPI memory management functions. This means that when VCPI is
- being used, interrupts will be disabled after calls to PMGETMEM,
- PMFREEMEM, PMRESETMEM, and PMMAPIO.
-
- 2) 386MAX version 7.0 does not properly report the virtual debug status
- register (virtual DR6) upon debug exceptions. Consequently, the DR6
- value presented by the XLIBE exception handler will not be valid. This
- version also fails to clear debug breakpoints upon termination, as
- required of DPMI 1.0 hosts. XLIBE corrects the latter problem by
- clearing breakpoints itself when terminating.
-
- 3) 386MAX version 7.0 apparently mismanages exception #13 from real mode.
- When the XLIBE exception handler attempts to terminate after such
- exceptions, a second exception #13 occurs. This has not proven to be a
- major problem. Simply ignore the second exception.
-
- 386MAX version 7.01 apparently corrects all of the above problems found
- in version 7.0. Qualitas has made a patch available to implement these
- corrections. Download the patch from the Qualitas BBS (301-907-8030). The
- patch for 386MAX is M701R.ZIP. The patch for BlueMax is B701R.ZIP.
-
- OS/2:
- -----
-
- OS/2 3.0 (Warp) and possibly previous versions do not preserve the high
- word of EDX upon certain calls to INT 21H function 3DH (open file). XLIB
- version 5.0 takes corrective action on this bug.
-
- Windows 3.1:
- ------------
-
- Windows DPMI doesn't handle INT 3 properly. The XLIB exception handler
- never receives control under this interrupt under Windows.
-
- TASM 4.0:
- ---------
-
- TASM 4.0 does not necessarily place DGROUP as the last segment if other
- data segments are defined after the .MODEL statement; consequently, it
- cannot be assumed that the stack will be located at the end of the program.
- This creates a problem when it becomes necessary to determine the size of
- a program for purposes of resizing the memory block in which DOS has placed
- it. The easiest way to correct this problem is by using FARSTACK in the
- .MODEL statement. If the stack must be in DGROUP (NEARSTACK), then all
- data segments should be defined before .MODEL and should be given a combine
- type of 'FAR_DATA'. This implies that if XLIBB or XLIBEB are to be used
- with NEARSTACK, then XLIBB.INC should be placed before .MODEL.
-
- ******************************************************************************
- Real-Mode Exception Trapping with DPMI Version 1.0
- ******************************************************************************
-
- DPMI 1.0 enables XLIBE to trap exception in real mode. This makes XLIBE
- potentially useful to programmers who would otherwise have no interest in
- protected-mode programming. Simply place a call to INITXLIB early in your
- program and link with XLIBE.LIB (XLIBEB.LIB for Borland users) to implement
- this feature.
- 386MAX version 7.X is the only DPMI 1.0 host of which we are presently
- aware. Version 7.01 is an outstanding product.
-
- ******************************************************************************
- Contracted Programming and Consultation
- ******************************************************************************
-
- TechniLib will perform contract programming at competitive rates.
- TechniLib will also serve as a consultant to other programmers. Contact
- TechniLib through the channels presented above.
-
- ******************************************************************************
- TechniLib Products
- ******************************************************************************
-
- TechniLib supplies numerous useful libraries to C, C++, and Assembly
- language programmers. Libraries are also available for BASIC, PASCAL,
- FORTRAN, and other languages. Most TechniLib libraries are written in
- assembly code; therefore, they are extremely fast and relatively small.
- These libraries can typically be found on CompuServe (GO MSLANG or GO
- BCPPDOS). Do a keyword search for TECHNILIB. Interested parties may
- also send inquiries directly to TechniLib by email.
-
- Library Description
- --------- -----------
- TRAN.LIB High performance random number generators for uniform and
- normal distributions. Designed for C and C++.
-
- TPROB.LIB Density functions, cumulative density functions, and inverse
- cumulative density functions for many of the major probability
- distributions (e.g. Normal, Chi-Squared, Gamma, Binomial, etc.).
- Includes other probability-related functions as well. Designed
- for C and C++.
-
- TXMS.LIB An interface to XMS (HIMEM.SYS) for C and C++. Provides very
- easy access to extended memory.
-
- BSTR.LIB BASIC-style string functions for C and C++.
-
- TCIO.LIB IO functions for C and C++. Featuring tprintf(), a function
- which emulates printf(), but which enables color printing and
- other formating features. tprintf() is over 15 times faster
- than printf(). Also featuring editstr(), a powerful string
- editor.
-
- TDAT.LIB Date and time functions for C and C++.
-
- MOPS.LIB Matrix operations library. Written in 32-bit protected-mode
- using the XLIB DOS extender. Extremely fast and accurate.
- Contact TechniLib for details.
-
-
- ******************************************************************************
- Improvements in XLIB Version 2.0 Over Version 1.0
- ******************************************************************************
-
- 1) Procedures enabling protected-mode programming in C using inline
- assembly.
- 2) Protected-mode file routines which can transfer extended memory to files
- or files to extended memory. Sequential and random access are supported.
- 3) Better interrupt management services.
- 4) User-defined descriptors.
- 5) More descriptors.
- 6) More configurability.
- 7) Minor bug fixes
- 8) Better documentation.
-
- ******************************************************************************
- Improvements in XLIB Version 3.0 Over Version 2.0
- ******************************************************************************
-
- 1) Files included in Borland formats.
- 2) EASYX library included for those unfamiliar with assembly language.
- 3) MAPIO and PMMAPIO procedures added to XLIB for accessing memory-mapped
- input/output devices.
- 4) Better documentation
-
- ******************************************************************************
- Improvements in XLIB Version 4.0 Over Version 3.0
- ******************************************************************************
-
- Additions:
-
- The principal improvement in version 4.0 is the inclusion of libraries
- with exception trapping capabilities. XLIB 4.0 can trap all protected-mode
- exceptions. If DPMI 1.0 is installed, then real-mode exceptions can be
- trapped as well. These libraries also contain new functions for managing
- debug watchpoints.
- XLIB 3.0 was limited in that it did not allow the main program to spawn
- other processes. This limitation has been corrected.
- The global descriptor table has been made public in version 4.0.
- PMPRINT.ASM has been replaced with PMIO.INC. The latter contains better
- print routines as well as new keyboard and speaker routines. PMIO.INC is
- designed for either MASM or TASM.
- The MOVMEM routine in EASYX has been redesigned to be faster and to be
- reentrant. This routine may now be called in the main thread, in interrupt
- handlers, or both.
- Microsoft BASIC 7.0 files have been included to illustrate usage of
- EASYX.
-
- Corrections:
-
- Version 4.0 corrects certain bugs and makes accommodations for anomalies
- in BIOS and common resident software.
- The most severe bug in version 3.0 was a mistake in the include file
- XLIB.INC. The combine type on segment DSEG was set to FAR_DATA, whereas it
- should have been DATA.
- A second bug caused the machine to crash with a call to INITXLIB when
- certain memory managers were used with the NOEMS option.
- Version 3.0 did not preserve the interrupt flag through mode switches.
- Instead it always enabled interrupts after the switch. This lead to awkward
- situations when attempting to use SWITCHPM and SWITCHRM in interrupt
- handlers. Version 4.0 always preserves the interrupt flag through a mode
- switch.
- A bug prevented SWITCHPM and SWITCHRM from being reentrant under VCPI.
- This bug existed in both versions 3.0 and 3.1. This would have caused a
- problem if nested mode switches were being performed, as would be the case
- with calls to DEFLECTPM or other mode switches within interrupt handlers.
- Certain versions of SMARTDRV.EXE do not restore the global descriptor
- table register. Version 3.0 was not prepared for this
- Certain BIOS software interrupts return with interrupts enabled. Neither
- version 3.0 nor version 3.1 were prepared for this anomaly. It caused the
- machine to hang upon certain hardware interrupts, keypresses in particular.
- The other bugs were applicable only when running XLIB in the absence of
- VCPI and DPMI (HIMEM.SYS only or no memory manager at all). Accesses to
- extended memory failed in some cases. In some cases the machine was left
- in an unstable state.
-
- ******************************************************************************
- Improvements in XLIB Version 4.1 Over Version 4.0
- ******************************************************************************
-
- Version 4.1 is minor upgrade. The exception handler under version 4.0
- did not properly manage keypresses. This problem has been corrected in
- version 4.1. A minor bug has also been corrected in DONTREAD.ME.
-
- ******************************************************************************
- Improvements in XLIB Version 5.0 Over Version 4.1
- ******************************************************************************
-
- XLIB version 5.0 is a major upgrade. Changes include:
-
- 1) Interrupt handlers for INT 23H (CTRL C) and INT 24H (DOS Critical Error)
- are included in version 5.0. In earlier version, termination under
- either of these interrupts left the machine in an unstable state.
- 2) The FPU interrupt handler has been improved. It now optionally presents
- a report of the FPU exception which includes the cause and location of
- the exception.
- 4) Version 5.0 contains new procedures for handling uncommitted memory.
- This is a very useful feature, but requires DPMI 1.0 (see below).
- 5) Earlier version of PMIO did not properly handle rounding in some very
- rare cases. A number such as 5.999999999 could have been printed as 5.0.
- The new version of PMIO.INC does not assume that DS contains a flat-model
- selector. PMIO may therefore be used with any segment settings. Also
- PMIO contains numerous additional procedures. Those presently using PMIO
- should consult the comments in this file before using the new version.
- 6) The archive for version 5.0 contains a new include file called FLAT.INC
- This file enables flat-model programming under DOS. The file is
- thoroughly documented. FLAT.ASM illustrates usage of FLAT.INC.
- 7) Example files for TASM programmers have been modified to use the FARSTACK
- option on the .MODEL statement. See the discussion below about bugs
- in compilers etc. for an explanation of this change.
- 8) Extensive changes have been made to documentation.
- 9) The availability of a protected-mode debugger is announced. See the file
- SWAT.DOC for details.
-
-